package com.jinmdz.fmis.dao.dao;

import com.jinmdz.fmis.dao.model.funeral.FamilyMemberItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import sun.text.normalizer.VersionInfo;

/**
 * 家属Dao
 *
 * @author LiCongLu
 * @date 2020-02-06 13:58
 */
public interface FamilyMemberDao {

    /**
     * 按照业务编码获取未删除逝者家属信息
     *
     * @param businessCode 业务编码
     * @return
     * @author LiCongLu
     * @date 2020-02-06 13:52
     */
    @Select(" select id,business_code,member_name,member_gender_code,certificate_type_code,certificate_no" +
            " ,member_name_unison,member_name_abbr,member_relation,mobile_phone,other_phone,address,remark,version,as_recognition " +
            " from family_member where business_code = #{businessCode} and deleted=0 limit 1 ")
    FamilyMemberItem getFamilyMemberByBusinessCode(@Param("businessCode") String businessCode);
    /**
     * 按照业务编码获取未删除逝者家属信息
     *
     * @param id id
     * @param asRecognition 是否核验
     * @param modifiedUserId 修改人
     * @param version 版本
     * @return
     * @author GaoXiangLiang
     * @date 2020-08-25 13:52
     */
    @Update(" update   family_member  set as_recognition=#{asRecognition}  ,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) " +
            " where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void updateFamilyMemberByBusinessCode(@Param("id") Integer id, @Param("asRecognition") Integer asRecognition, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

}
